// [ ﷽ ] Bismillahir Rahmanir Raheem//
#include<bits/stdc++.h>
#include<iostream>
#define ff first
#define ss second
#define pb push_back
#define int long long
#define noob ios::sync_with_stdio(0);cin.tie(0);
using namespace std;
void solve2(){
int m,b;
cin>>m>>b;
int ans=0;
for(int i=b;i>=0;i--){
int j=b*m-m*i;
int ct=(i*(i+1)/2)*(j+1)+(j*(j+1)/2)*(i+1);
ans=max(ans,ct);
}
cout<<ans<<endl;
}
void solve(){
int x,y;
for(int i=1;i<=5;i++){
for(int j=1;j<=5;j++){
int z;
cin>>z;
if(z==1){
x=i,y=j;
}
}
}
cout<<abs(3-x)+abs(3-y)<<endl;
}
void solve3(){
double x;
int a;
int n;
cin>>n>>a;
int r,s,t;
double y=1.0*a;
x=1.0*(n-2)*180/n;
int k=n-3;
double f=abs(x-y);
r=1,s=2,t=3;
int m=n;
//cout<<x<<" "<<f<<" ";
double p=(x/(1.0*(k+1)));
for(int i=1;i<=k;i++){
double d=p*(1.0)*i;
// cout<<d<<" "<<abs(d-y)<<" "<<f<<endl;
if(abs(d-y)<f){
t=m;
f=abs(d-y);
}
m--;
}
cout<<r<<" "<<s<<" "<<t<<endl;
}
signed main(){
noob
int t=1;
// cin>>t;
while(t--){
solve2();
}
return 0;
}
3. Longest Substring Without Repeating Characters | 1312. Minimum Insertion Steps to Make a String Palindrome |
1092. Shortest Common Supersequence | 1044. Longest Duplicate Substring |
1032. Stream of Characters | 987. Vertical Order Traversal of a Binary Tree |
952. Largest Component Size by Common Factor | 212. Word Search II |
174. Dungeon Game | 127. Word Ladder |
123. Best Time to Buy and Sell Stock III | 85. Maximal Rectangle |
84. Largest Rectangle in Histogram | 60. Permutation Sequence |
42. Trapping Rain Water | 32. Longest Valid Parentheses |
Cutting a material | Bubble Sort |
Number of triangles | AND path in a binary tree |
Factorial equations | Removal of vertices |
Happy segments | Cyclic shifts |
Zoos | Build a graph |
Almost correct bracket sequence | Count of integers |
Differences of the permutations | Doctor's Secret |